#define _CRT_SECURE_NO_WARNINGS 1
#include<bits/stdc++.h>
using namespace std;
const int N = 200010;
int a[N];

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int n, m, k; cin >> n >> m >> k;
    for (int i = 1; i <= n; i++) cin >> a[i];
    int ans = 0;
    for (int i = 1, j = 0, cnt = 0; i <= n; i++) {
        while (i > j || (j + 1 <= n && cnt < k)) {
            j++;                //cnt+=(a[++j]>=m);
            if (a[j] >= m) cnt++;
        }
        if (cnt >= k) ans += n - j + 1;
        if (a[i] >= m) cnt--; //cnt-=(a[i]>=m);
    }
    cout << ans << '\n';
    return 0;
}